feat: adding support for output to litara#897
feat: adding support for output to litara#897deranjer wants to merge 1 commit intocalibrain:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Litara (API) delivery output so Shelfmark can upload completed ebook downloads to Litara’s Book Drop flow (admin-approved ingestion), mirroring the existing Booklore/Grimmory output integration patterns.
Changes:
- Added a new
litaraoutput handler that logs in, uploads prepared files to Litara Book Drop, and optionally triggers a library scan. - Exposed Litara configuration and a “Test Connection” action in the Settings UI (plus per-user output mode override option).
- Updated docs to include the new output mode, environment variables, and custom-script output details.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/components/settings/users/UserOverridesSection.tsx | Adds Litara to per-user output mode override UI and normalization. |
| shelfmark/download/outputs/litara.py | New Litara output handler (login, upload to book drop, scan, custom-script context, staging cleanup). |
| shelfmark/download/outputs/init.py | Ensures Litara output handler is loaded into the output registry. |
| shelfmark/config/settings.py | Adds Litara output mode option + Litara settings fields and connection test button. |
| shelfmark/config/litara_settings.py | Implements “Test Connection” action using Litara login. |
| docs/users-and-requests.md | Documents Litara as an available per-user output mode choice. |
| docs/environment-variables.md | Documents Litara env vars + adds litara to BOOKS_OUTPUT_MODE options. |
| docs/custom-scripts.md | Documents Litara in output-mode/phase semantics and JSON payload output.details. |
| docs/configuration.md | Notes Litara (API) behaves like Booklore (API) (API upload vs writing to /books). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { value: 'folder', label: 'Folder' }, | ||
| { value: 'email', label: 'Email (SMTP)' }, | ||
| { value: 'booklore', label: 'Grimmory (API)' }, | ||
| { value: 'litara', label: 'Litara (API)' }, |
There was a problem hiding this comment.
The frontend has a shared BooksOutputMode union type (used by AppConfig.books_output_mode) that still only allows 'folder' | 'booklore' | 'email'. With this new mode option, that type (and any related switch/guards) should be updated to include 'litara' so TypeScript can correctly represent the config value and downstream UI logic can handle the new mode explicitly.
| { | ||
| "value": "litara", | ||
| "label": "Litara (API)", | ||
| "description": "Upload files directly to Litara", |
There was a problem hiding this comment.
The output-mode option description says "Upload files directly to Litara", but this integration uploads to Litara Book Drop (admin approval flow) rather than directly into a library. Updating this description to explicitly mention Book Drop will prevent user confusion and better match the behavior/heading text below.
| "description": "Upload files directly to Litara", | |
| "description": "Upload files to Litara Book Drop", |
| @register_output(LITARA_OUTPUT_MODE, supports_task=_supports_litara, priority=10) | ||
| def process_litara_output( | ||
| temp_file: Path, | ||
| task: DownloadTask, | ||
| cancel_flag: Event, | ||
| status_callback: StatusCallback, | ||
| *, |
There was a problem hiding this comment.
There is good test coverage for the Booklore output handler (upload endpoint selection, unsupported formats, router integration, custom-script payload). This new Litara output handler introduces similar behavior (login, upload, unsupported-format rejection, post_upload script context), but there are no corresponding tests yet. Adding unit tests for litara_login/litara_upload_file and an integration-style router test for BOOKS_OUTPUT_MODE=litara would help prevent regressions.
|
Hi, appreciate the work, but given Litara looks very new i'd prefer to avoid the precedent of adding too many custom output options immediately when a new app is launched. I presume Litara has a bookdrop folder that would work with shelfmark's folder output, no API required? |
|
Yes, it has a bookdrop folder. |
Following booklore's setup, this adds support for litara ereader upload to book drop. Unlike booklore litara does not support uploading directly to libraries, it must go through the book drop process. This allows shelfmark to submit a file directly to litara's book drop, which allows the admin to approve the book and that adds it to the library.
EDIT: Ah, should have looked at the Makefile closer. Let me run all the required tests, add a test file for litara, then update this PR.